# Maintainer: Christian Hesse <mail@eworm.de>
# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Chris Brannon <chris@the-brannons.com>
# Contributor: Dag Odenhall <dag.odenhall@gmail.com>

pkgname=rss2email
pkgver=3.14
pkgrel=5
pkgdesc='A tool for delivering news from RSS feeds to your email program'
arch=('any')
url='https://github.com/rss2email/rss2email'
license=('GPL')
depends=('python' 'python-html2text' 'python-feedparser')
makedepends=('python-build' 'python-installer' 'python-poetry-core')
source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz"
        '0001-Use-poetry-core-as-build-backend.patch')
sha256sums=('ea09b68f6a5421b0bd50e98e24d49a0a33bd54a5f59d0f1be1f6f3f05b8c6087'
            'eea10b00b105d77d9054adfb344b64b85b49c45a02b3dec2e3e8e07ca0261c6a')

prepare() {
	cd ${pkgname}-${pkgver}
	patch --forward --strip=1 --input=../0001-Use-poetry-core-as-build-backend.patch
}

build() {
	cd ${pkgname}-${pkgver}
	python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
	cd ${pkgname}-${pkgver}
	python -m installer --destdir="${pkgdir}" dist/*.whl
	install -Dm644 -t "${pkgdir}"/usr/share/man/man1 r2e.1
	install -Dm644 completion/r2e.zsh "${pkgdir}"/usr/share/zsh/site-functions/_r2e
}
